<template>
  <div class="tablewrap">
    <div>当前可参加的活动</div>
    <FilterTable :isColumnFilter="false" :columns="columns" :dataSource="dataSource" :height="200" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
  </div>
</template>

<script>
import moment from 'moment';
import { queryActivityValid } from '@/api/repair/business/customer/monitoring.js';
export default {
  name: 'HuoDong0',
  data() {
    return {
      // 活动 可选的
      columns: this.createColumnsActivitiesOptional(),
      dataSource: []
    };
  },
  mounted() {
    this.queryActivityValid();
  },
  methods: {
    // 查询可选活动
    async queryActivityValid() {
      const params = {
        sort: 'ACTIVITY_CODE',
        order: 'asc',
        LICENSE: '陕A2FU00',
        undefined: '10015',
        vin: '09876543219876543',
        ownerNo: 'OW1907110001',
        BRAND: 'LINCOLN',
        MILEAGE: '999999',
        isRepairOrder: 'REPAIR_ORDER_TAG',
        createDate: moment().format('YYYY-MM-DD HH-mm'), // '2019-08-14 20:20',
        monitor_table: '',
        activity1_table: '',
        activity2_table: '',
        booking_table: '',
        insurance_table: '',
        warning_table: '',
        dmsFuncId: '35100010',
        _: moment().valueOf()
      };
      const res = await queryActivityValid(params);
      this.dataSource = res;
    },
    // 活动 可选的
    createColumnsActivitiesOptional() {
      return [
        {
          title: '序号'
        },
        {
          title: '活动编号',
          dataIndex: 'ACTIVITY_CODE'
        },
        {
          title: '活动名称',
          dataIndex: 'ACTIVITY_NAME'
        },
        {
          title: '活动类型',
          dataIndex: 'ACTIVITY_TYPE'
        },
        {
          title: '开始日期',
          dataIndex: 'BEGIN_DATE'
        },
        {
          title: '结束日期',
          dataIndex: 'END_DATE'
        },
        {
          title: '活动总金额',
          dataIndex: 'ACTIVITY_AMOUNT'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
